<script setup>
import {ref} from 'vue';
import {HomeFilled, Message, Plus} from "@element-plus/icons-vue";
import ChatList from "@/components/Chat/ChatList.vue";
import ChatWindow from "@/components/Chat/ChatWindow.vue";
const currentChatId = ref('chat-1');


const startNewChat = () => {
  // 打开新聊天窗口
  console.log('开始新聊天')
}
const loadChat = (chatId) => {
  console.log('加载聊天记录', chatId)
  currentChatId.value = chatId;
}

const {historyList} = defineProps({
  historyList: {
    type: Array,
    default: [
      {id: 'chat-1', title: '记录1'},
      {id: 'chat-2', title: '记录2'},
      {id: 'chat-3', title: '记录3'}
    ]
  }
});

const messages = ref([]);
const newMessage = ref('');

const sendMessage = () => {
  if (newMessage.value.trim()) {
    messages.value.push({role: 'user', content: newMessage.value});
    // Simulate AI response
    setTimeout(() => {
      messages.value.push({role: 'Ai', content: '这是 AI 响应。'});
    }, 1000);
    newMessage.value = '';
  }
};
</script>
<template>
  <div class="chat-layout">
    <el-card>
        <ChatList></ChatList>
    </el-card>

    <el-container>
      <el-main>
        <ChatWindow/>

      </el-main>
    </el-container>
  </div>
</template>



<style scoped>
  .chat-layout {
    display: flex;
    gap: 20px;
    padding: 20px;
    height: 100%;
    box-sizing: border-box;
  }

  .chat-main {
    flex: 1;
    overflow: hidden;
  }


  </style>
